package com.cbts.entity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * BusinessTravelList entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "business_travel_list", catalog = "cbts")
public class BusinessTravelList implements java.io.Serializable {

	// Fields

	private String travelOrder;
	private UserInfo userInfoByVerifierId;
	private UserInfo userInfoByUserid;
	private Date startTime;
	private Date endTime;
	private Double amount;
	private String verifierStatus;
	private ApplayReim applayReim;
	private Set<BusinessTravel> businessTravels = new HashSet<BusinessTravel>(0);

	// Constructors

	/** default constructor */
	public BusinessTravelList() {
		verifierStatus="待审核";
		amount=0.00;
	}

	/** minimal constructor */
	public BusinessTravelList(String travelOrder, UserInfo userInfoByUserid,
			Date startTime, Date endTime, Double amount) {
		this.travelOrder = travelOrder;
		this.userInfoByUserid = userInfoByUserid;
		this.startTime = startTime;
		this.endTime = endTime;
		this.amount = amount;
	}

	/** full constructor */
	public BusinessTravelList(String travelOrder,
			UserInfo userInfoByVerifierId, UserInfo userInfoByUserid,
			Date startTime, Date endTime, Double amount, String verifierStatus,
			ApplayReim applayReim, Set<BusinessTravel> businessTravels) {
		this.travelOrder = travelOrder;
		this.userInfoByVerifierId = userInfoByVerifierId;
		this.userInfoByUserid = userInfoByUserid;
		this.startTime = startTime;
		this.endTime = endTime;
		this.amount = amount;
		this.verifierStatus = verifierStatus;
		this.applayReim = applayReim;
		this.businessTravels = businessTravels;
	}

	// Property accessors
	@Id
	@Column(name = "travelOrder", unique = true, nullable = false, length = 26)
	public String getTravelOrder() {
		return this.travelOrder;
	}

	public void setTravelOrder(String travelOrder) {
		this.travelOrder = travelOrder;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "verifierId")
	public UserInfo getUserInfoByVerifierId() {
		return this.userInfoByVerifierId;
	}

	public void setUserInfoByVerifierId(UserInfo userInfoByVerifierId) {
		this.userInfoByVerifierId = userInfoByVerifierId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "userid", nullable = false)
	public UserInfo getUserInfoByUserid() {
		return this.userInfoByUserid;
	}

	public void setUserInfoByUserid(UserInfo userInfoByUserid) {
		this.userInfoByUserid = userInfoByUserid;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "startTime", nullable = false, length = 10)
	public Date getStartTime() {
		return this.startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = new Date(startTime.getTime());
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "endTime", nullable = false, length = 10)
	public Date getEndTime() {
		return this.endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = new Date(endTime.getTime());
	}

	@Column(name = "amount", nullable = false, precision = 11)
	public Double getAmount() {
		return this.amount;
	}

	public void setAmount(Double amount) {
		this.amount = amount;
	}

	@Column(name = "verifierStatus", length = 5)
	public String getVerifierStatus() {
		return this.verifierStatus;
	}

	public void setVerifierStatus(String verifierStatus) {
		this.verifierStatus = verifierStatus;
	}

	@OneToOne(fetch = FetchType.LAZY, mappedBy = "businessTravelList")
	public ApplayReim getApplayReim() {
		return this.applayReim;
	}

	public void setApplayReim(ApplayReim applayReim) {
		this.applayReim = applayReim;
	}

	@OneToMany( fetch = FetchType.LAZY, mappedBy = "businessTravelList")
	public Set<BusinessTravel> getBusinessTravels() {
		return this.businessTravels;
	}

	public void setBusinessTravels(Set<BusinessTravel> businessTravels) {
		this.businessTravels = businessTravels;
	}

}